/*
 * @Author: NtyAaron
 * @Date: 2021-04-12 11:13:45
 * @LastEditors: NtyAaron
 * @LastEditTime: 2021-04-16 10:18:09
 * @Description: file content
 * @FilePath: \dwq\pages\my\personalInfo\personalInfo.js
 */
import { getUser } from '../../../api/user/user'
import {_t} from '../../../i18n/base'
Page({
  data: {
    userInfo: {},
  },
  // 获取用户信息
  async getUser() {
    let userInfo = wx.getStorageSync('userInfo')
    if (!userInfo) {
    } else {
      let { result } = await getUser(JSON.parse(userInfo))
      if(result.phoneNumber){
        result.phoneNumber = result.phoneNumber.substr(0,3) + '****' + result.phoneNumber.substr(7,10)
        result.purePhoneNumber = result.purePhoneNumber.substr(0,3) + '****' + result.purePhoneNumber.substr(7,10)
      }
      this.setData({
        userInfo: result,
      })
    }
  },
  onShow() {
    this.getUser()
  },
  onLoad(){
    let lang = _t();
    this.setData({
      lang
    })
    wx.setNavigationBarTitle({
      title: lang['个人信息'],
    })
  }
})
